package com.levi.juc.coll_unsafe.list_set;

import java.util.ArrayList;
import java.util.UUID;

/**
 * List是不安全的，多线程同时修改集合，会出现ConcurrentModificationException异常
 */
public class ListTest {
    public static void main(String[] args) {
        ArrayList<String> list = new ArrayList<>();
        for (int i = 0; i < 10; i++) {
            new Thread(()->{
                list.add(UUID.randomUUID().toString().substring(1, 5));
                System.out.println(list);
            },String.valueOf(i)).start();
        }

    }


}
